.form-group, .buttons {
    position: relative;
    margin: var(--space-m) 0;
}

.select-group {
    display: flex;
    align-content: center;
    align-items: center;
}

.help-link {
    flex-shrink: 0;
    color: light-dark(var(--grey600), var(--grey700));
    padding: var(--space-3xs);
    margin: calc(-1 * var(--space-3xs));

    &:hover {
        color: light-dark(var(--grey700), var(--grey600));
    }

    :global(svg) {
        width: 1em;
        height: 1em;
    }
}

.buttons {
    display: flex;
    gap: var(--space-2xs);
    flex-wrap: wrap;
}

.name-input {
    max-width: 440px;
    width: 100%;
}

.expiry-select {
    padding-right: var(--space-m);
    background-image: url("/assets/dropdown-black.svg");
    background-repeat: no-repeat;
    background-position: calc(100% - var(--space-2xs)) center;
    background-size: 10px;
    appearance: none;

    [data-color-scheme="system"] & {
        @media (prefers-color-scheme: dark) {
            background-image: url("/assets/dropdown-white.svg");
        }
    }

    [data-color-scheme="dark"] & {
        background-image: url("/assets/dropdown-white.svg");
    }
}

.expiry-date-input {
    margin-left: var(--space-2xs);
}

.expiry-description {
    margin-left: var(--space-2xs);
    font-size: 0.9em;
}

:global(.scopes-list) {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: light-dark(white, #141413);
    border: 1px solid var(--gray-border);
    border-radius: var(--space-3xs);

    &:global(.invalid) {
        background: light-dark(#fff2f2, #170808);
        border-color: red;
    }

    > * + * {
        border-top: inherit;
    }

    :global(label) {
        padding: var(--space-xs) var(--space-s);
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-xs);
        font-size: 0.9em;
    }
}

.scope-id {
    display: inline-block;
    max-width: 170px;
    flex-grow: 1;
    font-weight: bold;
}

.scope-description {
    display: inline-block;
}

.crates-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: light-dark(white, #141413);
    border: 1px solid var(--gray-border);
    border-radius: var(--space-3xs);

    > * + * {
        border-top: inherit;
    }
}

.crates-unrestricted {
    padding: var(--space-xs) var(--space-s);
    font-size: 0.9em;
}

.crates-scope {
    display: flex;

    > :global(div) {
        padding: var(--space-xs) var(--space-s);
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-xs);
        font-size: 0.9em;
        flex-grow: 1;
    }

    :global(input) {
        margin: calc(-1 * var(--space-4xs)) 0;
        padding: var(--space-3xs) var(--space-2xs);
        border: 1px solid var(--gray-border);
        border-radius: var(--space-3xs);
    }

    &.invalid :global(input) {
        background: light-dark(#fff2f2, #170808);
        border-color: red;
    }

    > :global(button) {
        margin: 0;
        padding: 0 var(--space-xs);
        border: none;
        background: none;
        cursor: pointer;
        color: var(--grey700);
        flex-shrink: 0;
        display: flex;
        align-items: center;

        &:hover {
            background: light-dark(var(--grey200), #333333);
            color: light-dark(var(--grey900), white);
        }

        :global(svg) {
            height: 1.1em;
            width: 1.1em;
        }
    }

    &:first-child button {
        border-top-right-radius: var(--space-3xs);
    }
}

.pattern-description {
    flex-grow: 1;
    align-self: center;

    .invalid & {
        color: red;
    }

    > :global(span) {
        font-weight: bold;
    }
}

.crates-pattern-button :global(button) {
    padding: var(--space-xs) var(--space-s);
    font-size: 0.9em;
    width: 100%;
    border: none;
    background: none;
    border-bottom-left-radius: var(--space-3xs);
    border-bottom-right-radius: var(--space-3xs);
    cursor: pointer;
    font-weight: bold;

    &:hover {
        background: light-dark(var(--grey200), #333333);
    }
}

.generate-button {
    border-radius: 4px;

    .spinner {
        margin-left: var(--space-2xs);
    }
}

.cancel-button {
    border-radius: 4px;
}
